package com.bmps.springcloud.insuredmicroservice.model.accept.response;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import java.io.Serializable;

/**
*  @author lyw
*  @date 2019/07/24
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"header", "response"})
public class AcceptResponseDataModel implements Serializable {

    private ResponseHeaderModel header;

    private ResponseModel response;

    @JsonIgnore
    @JSONField(serialize=false)
    private Boolean  flag;

    public ResponseHeaderModel getHeader() {
        return header;
    }

    public void setHeader(ResponseHeaderModel header) {
        this.header = header;
    }

    public ResponseModel getResponse() {
        return response;
    }

    public void setResponse(ResponseModel response) {
        this.response = response;
    }

    public Boolean getFlag() {
        return flag;
    }

    public void setFlag(Boolean flag) {
        this.flag = flag;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o){
            return true;
        }

        if (o == null || getClass() != o.getClass()){
            return false;
        }

        AcceptResponseDataModel that = (AcceptResponseDataModel) o;

        return new EqualsBuilder()
                .append(header, that.header)
                .append(response, that.response)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(header)
                .append(response)
                .toHashCode();
    }

    @Override
    public String toString() {
        return "AcceptResponseDataModel{" +
                "header=" + header +
                ", response=" + response +
                '}';
    }
}
